home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / M / MacPerl 4.13 source.sit / Perl Source ƒ / MacPerl / MPGlobals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-04  |  6.4 KB  |  327 lines  |  [TEXT/MPS ]

  1. /*********************************************************************
  2. Project    :    MacPerl                -    Real Perl Application
  3. File        :    MPGlobals.h    -
  4. Author    :    Matthias Neeracher
  5.  
  6. A lot of this code is borrowed from 7Edit written by
  7. Apple Developer Support UK
  8.  
  9. Language    :    MPW C
  10.  
  11. $Log: MPGlobals.h,v $
  12. Revision 1.2  1994/05/04  02:51:46  neeri
  13. Inline Input.
  14.  
  15. Revision 1.1  1994/02/27  23:03:27  neeri
  16. Initial revision
  17.  
  18. Revision 0.5  1993/12/12  00:00:00  neeri
  19. PerlPrefs, SacrificalGoat
  20.  
  21. Revision 0.4  1993/08/17  00:00:00  neeri
  22. LibraryPaths
  23.  
  24. Revision 0.3  1993/08/05  00:00:00  neeri
  25. Small icons
  26.  
  27. Revision 0.2  1993/05/29  00:00:00  neeri
  28. Support console windows
  29.  
  30. Revision 0.1  1993/05/29  00:00:00  neeri
  31. Compiles correctly
  32.  
  33. *********************************************************************/
  34.  
  35. #ifndef __MPGLOBALS__
  36. #define __MPGLOBALS__
  37.  
  38. #include <Types.h>
  39. #include <QuickDraw.h>
  40. #include <Menus.h>
  41. #include <Editions.h>
  42. #include <Printing.h>
  43. #include <AppleEvents.h>
  44. #include <TextServices.h>
  45. #include <TSMTE.h>
  46.  
  47. #include "MPRsrc.h"
  48.  
  49. #ifndef EXTERN
  50. #define EXTERN extern 
  51. #endif
  52.  
  53. #define    LibraryPaths    128
  54.  
  55. /*
  56.     Items in Apple Menu
  57. */
  58.  
  59. #define  aboutItem  1
  60.  
  61. /*
  62.     Items in File Menu
  63. */
  64.  
  65. #define  fmNew                    1
  66. #define  fmOpen                2
  67. #define  fmClose                4
  68. #define  fmSave                5
  69. #define  fmSaveAs                6
  70. #define  fmRevert                7
  71. #define  fmPageSetUp            9
  72. #define  fmPrint                10
  73. #define  fmQuit                12
  74.  
  75. /*
  76.     Items in Edit Menu
  77. */
  78. #define  undoCommand            1
  79. #define  cutCommand             3
  80. #define  copyCommand         4
  81. #define  pasteCommand         5
  82. #define  clearCommand         6
  83. #define  selectAllCommand     7
  84.  
  85. #define    emFormat                9
  86.  
  87. #ifndef RUNTIME
  88.  
  89. #define  cPublisher           11
  90. #define  cSubscriber          12
  91. #define  cOptions             13
  92. #define  cBorders             14
  93.  
  94. #define    emPreferences        16
  95.  
  96. #else
  97.  
  98. #define    emPreferences        11
  99.  
  100. #endif
  101.  
  102. /*
  103.     Items in Perl Menu
  104. */
  105. #define    pmRun                1
  106. #define    pmRunFront        2
  107.  
  108. #ifndef RUNTIME
  109.  
  110. /*
  111.     Item in Help Menu
  112. */
  113. #define    hmExplain        5
  114.  
  115. #endif
  116.  
  117. /*
  118.     Entry of Menu in myMenus
  119. */
  120. #define  appleM             0
  121. #define  fileM              1
  122. #define  editM              2
  123. #define    windowM            3
  124. #define    perlM                4
  125.  
  126. #ifndef RUNTIME
  127.  
  128. #define    helpM                5
  129. #define  kLastMenu        5
  130.  
  131. #else
  132.  
  133. #define kLastMenu            4
  134.  
  135. #endif
  136.  
  137. /*
  138.     Save Changes Dialog Items
  139. */
  140.  
  141. #define  aaSave              1
  142. #define  aaDiscard          2
  143. #define  aaCancel         3
  144.  
  145. #define  kOSEvent                       app4Evt    /*event used by MultiFinder*/
  146. #define  kSuspendResumeMessage        1        /*high byte of suspend/resume event message*/
  147. #define  kResumeMask                         1        /*bit of message field for resume vs. suspend*/
  148. #define  kMouseMovedMessage              0xFA    /*high byte of mouse-moved event message*/
  149. #define  kNoEvents                         0        /*no events mask*/
  150.  
  151. /* How much memory to set aside for emergencies */
  152.  
  153. #define SACRIFICE        32768
  154.  
  155. /* File too bulky for TextEdit */
  156.  
  157. #define elvisErr        666
  158.  
  159. /*
  160.     this is a section record to hold the information about
  161.     the publishers and subscribers in this document
  162. */
  163.  
  164. struct SectRec {
  165.     SectionHandle   fSectHandle;
  166.     short           fSectionID;
  167.     RgnHandle       fBorderRgn; /*handle to the outside border*/
  168.     Rect            fInnerBounds;
  169.     short           fStart;     /*fStart and fEnd are both specific to a*/
  170.     short           fEnd;       /*text handling application- start and end of text selection*/
  171.     struct SectRec  **fNextSection;
  172.     FSSpec          fFSSpec;
  173.     short           fCount;
  174.     Handle          fTextHandle;
  175.     Boolean         fChanged; /*has the section been changed*/
  176.     struct DocRec   *fDocument;
  177. };
  178.  
  179. typedef struct SectRec SectRec;
  180. typedef SectRec *SectPtr, **SectHandle;
  181.  
  182. typedef enum {
  183.     kDocumentWindow,
  184.     kWorksheetWindow,
  185.     kConsoleWindow
  186. } WindowKind;
  187.  
  188. typedef struct RegularDoc {
  189.     Boolean          showBorders;
  190.     Boolean        everSaved;
  191.     SectHandle       firstSection; /*the first section in the list*/
  192.     SectHandle       lastSection;  /*the last section*/
  193.     short          numSections;
  194.     short          lastID;      /*the last sectionID*/
  195. } RegularDoc;
  196.  
  197. struct DocRec;
  198.  
  199. typedef struct ConsoleDoc {
  200.     struct DocRec *next;
  201.     Ptr                cookie;
  202.     short                memory;
  203.     short                fence;
  204.     Boolean            selected;
  205. } ConsoleDoc;
  206.  
  207. enum {
  208.     stateConsole = 0x0001,
  209.     stateDocument= 0x0002,
  210.     stateRdWr    = 0x0010,
  211.     stateRdOnly  = 0x0020,
  212.     stateBlocked = 0x0030
  213. };
  214.  
  215. typedef enum {
  216.     kPreferenceDoc = -1,
  217.     kUnknownDoc,
  218.     kPlainTextDoc,
  219.     kScriptDoc,
  220.     kRuntime6Doc,
  221.     kRuntime7Doc,
  222.     kOldRuntime6Doc
  223. } DocType;
  224.  
  225. struct DocRec {
  226.     TEHandle       theText;
  227.     ControlHandle  vScrollBar;
  228.     ControlHandle  hScrollBar;
  229.     WindowPtr      theWindow;
  230.     short          refNum;
  231.     short                lastState;
  232.     Str255         theFileName;
  233.     FSSpec           theFSSpec;
  234.     THPrint        thePrintSetup;
  235.     Rect           pageSize;    /*From thePrintSetUp^^.prInfo.rPage but 0 offset*/
  236.     Boolean        dirty;
  237.     DocType            type;
  238.     WindowKind        kind;
  239. #ifndef RUNTIME
  240.     TSMTERecHandle    tsmTERecHandle;
  241.     TSMDocumentID    tsmDoc;
  242. #endif
  243.     union {
  244.         RegularDoc    reg;
  245.         ConsoleDoc    cons;
  246.     } u;
  247. };
  248.  
  249. typedef struct DocRec DocRec;
  250. typedef DocRec *DPtr;
  251.  
  252. struct HeaderRec {
  253.     Rect        theRect;
  254.     Str255   theFont;
  255.     short        theSize;
  256.     short    theLength;
  257.     short    numSections;
  258.     short    lastID;
  259. };
  260.  
  261. typedef struct HeaderRec HeaderRec;
  262. typedef HeaderRec *HPtr, **HHandle;
  263.  
  264. struct DocFormat {
  265.     short        font;
  266.     short        size;
  267. };
  268.  
  269. typedef struct DocFormat DocFormat;
  270.  
  271. struct PerlPrefs    {
  272.     short        version;
  273. #define PerlPrefVersion411    0
  274. #define PerlPrefVersion413    1
  275.     Boolean    runFinderOpens;
  276.     Boolean    checkType;
  277.     Boolean    inlineInput;
  278. };
  279.  
  280. typedef struct PerlPrefs PerlPrefs;
  281.  
  282. EXTERN short              gWCount;
  283. EXTERN short              gNewDocCount;
  284. EXTERN MenuHandle         myMenus[kLastMenu+1];
  285. EXTERN short              gFontMItem;
  286. EXTERN Boolean            gQuitting;
  287. EXTERN Cursor             editCursor;
  288. EXTERN Cursor             waitCursor;
  289. EXTERN Boolean            gInBackground;
  290. EXTERN Boolean                gRunningPerl;
  291. EXTERN DPtr                    gConsoleList;
  292. EXTERN short                gPrefsFile;
  293. EXTERN short                gScriptFile;
  294. EXTERN WindowPtr            gActiveWindow;
  295. EXTERN short                gAppFile;
  296. EXTERN short                gAppVol;
  297. EXTERN long                    gAppDir;
  298. EXTERN DocFormat            gFormat;
  299. EXTERN Handle                gRuntimeScript;
  300. EXTERN Handle                gPseudoFile;
  301. EXTERN AppleEvent ***    gWaitingScripts;
  302. EXTERN DPtr                    gGotEof;
  303. EXTERN PerlPrefs            gPerlPrefs;
  304. EXTERN Handle                gSacrificialGoat;
  305.  
  306. #ifndef RUNTIME
  307.  
  308. EXTERN long         gSavedFontForce;
  309.  
  310. #endif
  311.  
  312.   /*now for the environment variables set up by Gestalt*/
  313.  
  314. EXTERN Boolean    gAppleEventsImplemented;
  315.  
  316. #ifndef RUNTIME
  317.  
  318. EXTERN Boolean    gAliasManagerImplemented;
  319. EXTERN Boolean    gEditionManagerImplemented;
  320. EXTERN Boolean    gOutlineFontsImplemented;
  321. EXTERN Boolean    gRecordingImplemented;
  322. EXTERN Boolean        gTextServicesImplemented;
  323. EXTERN Boolean        gTSMTEImplemented;
  324.  
  325. #endif
  326.  
  327. #endif